You can use the function KCFindFirstItem to find the first the first keychain item in a keychain that matches certain attributes. KCFindFirstItem passes back a reference to the item and to the current search criteria. You pass the search reference returned by to KCFindFirstItem to the function KCFindNextItem . KCFindNextItem finds the next keychain item matching the criteria used by KCFindFirstItem and returns a reference to the matching item, if any.
When you are completely finished with a search performed by calling the functions KCFindNextItem or KCFindNextItem , call the function KCReleaseSearch to release the memory occupied by a search criteria reference.